{template 'public/header'}
{template 'public/comhead'}
{if $operation == 'display'}
<script>
require(['bootstrap'],function($){
	$('.btn,.tips').hover(function(){
		$(this).tooltip('show');
	},function(){
		$(this).tooltip('hide');
	});
});
</script>
<div class="main">
    <style>
        .form-control-excel {
            height: 34px;
            padding: 6px 12px;
            font-size: 14px;
            line-height: 1.42857143;
            color: #555;
            background-color: #fff;
            background-image: none;
            border: 1px solid #ccc;
            border-radius: 4px;
            -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075);
            box-shadow: inset 0 1px 1px rgba(0,0,0,.075);
            -webkit-transition: border-color ease-in-out .15s,-webkit-box-shadow ease-in-out .15s;
            -o-transition: border-color ease-in-out .15s,box-shadow ease-in-out .15s;
            transition: border-color ease-in-out .15s,box-shadow ease-in-out .15s;
        }	
    </style>
    <div class="panel panel-info">
        <div class="panel-heading">缴费订单列表</div>
		<div class="panel-body">
			<form action="./index.php" method="get" class="form-horizontal" role="form">
				<input type="hidden" name="c" value="site">
				<input type="hidden" name="a" value="entry">
				<input type="hidden" name="m" value="fm_jiaoyu">
				<input type="hidden" name="do" value="payall"/>
				<input type="hidden" name="op" value="display"/>
				<input type="hidden" name="schoolid" value="{$schoolid}" />
				<input type="hidden" name="is_pay" value="{$_GPC['is_pay']}"/>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-1 control-label">支付状态</label>
					<div class="col-sm-9 col-xs-9 col-md-9">
						<div class="btn-group">
							<a href="{php echo $this->createWebUrl('payall', array('id' => $item['id'], 'is_pay' => '-1', 'schoolid' => $schoolid))}" class="btn {if $is_pay == -1}btn-primary{else}btn-default{/if}">不限</a>
							<a href="{php echo $this->createWebUrl('payall', array('id' => $item['id'], 'is_pay' => '1', 'schoolid' => $schoolid))}" class="btn {if $is_pay == 1}btn-primary{else}btn-default{/if}">未支付</a>
							<a href="{php echo $this->createWebUrl('payall', array('id' => $item['id'], 'is_pay' => '2', 'schoolid' => $schoolid))}" class="btn {if $is_pay == 2}btn-primary{else}btn-default{/if}">已支付</a>
							<a href="{php echo $this->createWebUrl('payall', array('id' => $item['id'], 'is_pay' => '3', 'schoolid' => $schoolid))}" class="btn {if $is_pay == 3}btn-primary{else}btn-default{/if}">已退费</a>
						</div>
					</div>
				</div>
				<div class="form-group clearfix">
					<label class="col-xs-12 col-sm-3 col-md-1 control-label">按订单号搜索</label>
                    <div class="col-sm-2 col-lg-2">
                        <input class="form-control" name="number" id="" type="text" value="{$_GPC['number']}">
                    </div>						
				</div>
				<div class="form-group clearfix">
					<label class="col-xs-12 col-sm-3 col-md-1 control-label">按学生姓名搜索</label>
                    <div class="col-sm-2 col-lg-2">
                        <input class="form-control" name="keyword" id="" type="text" value="{$_GPC['keyword']}">
                    </div>						
				</div>				
				<div class="form-group clearfix">
					<label class="col-xs-12 col-sm-3 col-md-1 control-label">按订单类型</label>
					<div class="col-sm-2 col-lg-2">
						<select style="margin-right:15px;" name="type" class="form-control">
							<option value="0">按付费类型搜索</option>
							<option value="1" {if $_GPC['type'] == 1} selected="selected"{/if}>课程付费</option>
							<option value="3" {if $_GPC['type'] == 3} selected="selected"{/if}>项目缴费</option>
							<option value="4" {if $_GPC['type'] == 4} selected="selected"{/if}>报名付费</option>
							<option value="5" {if $_GPC['type'] == 5} selected="selected"{/if}>考勤卡费</option>
						</select>	
					</div>					
					<div class="col-sm-2 col-lg-2">
						<select style="margin-right:15px;" name="obid" class="form-control">
							<option value="0">按缴费项目搜索</option>
							{loop $allob $row}
							<option value="{$row['id']}" {if $row['id'] == $_GPC['obid']} selected="selected"{/if}>{$row['name']}</option>
							{/loop}
						</select>
					</div>
					<div class="col-sm-2 col-lg-2">
						<select style="margin-right:15px;" name="kcid" class="form-control">
							<option value="0">按课程名称搜索</option>
							{loop $allkc $row}
							<option value="{$row['id']}" {if $row['id'] == $_GPC['kcid']} selected="selected"{/if}>{$row['name']}</option>
							{/loop}
						</select>	
					</div>
					<div class="col-sm-2 col-lg-2">
						<select style="margin-right:15px;" name="paytype" class="form-control">
							<option value="0">按支付类型搜索</option>
							<option value="1" {if $_GPC['paytype'] == 1} selected="selected"{/if}>在线支付</option>
							<option value="2" {if $_GPC['paytype'] == 2} selected="selected"{/if}>现金支付</option>
						</select>	
					</div>					
				</div>				
				<div class="form-group clearfix">
					<label class="col-xs-12 col-sm-3 col-md-1 control-label">下单时间</label>
					<div class="col-sm-2 col-lg-2">
						{php echo tpl_form_field_daterange('createtime', array('start' => date('Y-m-d', $starttime), 'end' => date('Y-m-d', $endtime)));}
					</div>
					<div class="col-sm-2 col-lg-2">
						<button class="btn btn-default"><i class="fa fa-search"></i> 搜索</button>
					</div>	
					<div class="col-sm-2 col-lg-2">
						<button class="btn btn-success" name="out_put" value="output"><i class="fa fa-download"></i>导出至EXECL</button>
					</div>
				</div>
			</form>
		</div>		
    </div>
    <div class="panel panel-default">
        <div class="table-responsive panel-body">
        <form action="" method="post" class="form-horizontal form" enctype="multipart/form-data">
		<input type="hidden" name="schoolid" value="{$schoolid}" />
        <table class="table table-hover">
			<thead class="navbar-inner">
				<tr>
                    <th class='with-checkbox' style="width: 20px;"><input type="checkbox" class="check_all" /></th>
					<th style="width:5%">订单号 </th>
					<th style="width:15%">项目名</th>
					<th style="width:6%;">学生</th>
					<th style="width:8%;">班级</th>
					<th style="width:8%;">缴费人</th>
                    <th style="width:8%;">手机</th>
					<th style="width:15%;">付费时间</th>
                    <th style="width:5%;">金额</th>
					<th style="width:6%;">收款账户</th>
					<th style="width:5%;">支付状态</th>
					<th style="width:6%;">支付方式</th>
					<th style="width:6%;">支付类型</th>
					<th style="text-align:right; width:10%;">操作</th>
				</tr>
			</thead>
			<tbody>
				{loop $list $item}
				<tr>
                    <td class="with-checkbox"><input type="checkbox" name="check" value="{$item['id']}"></td>
					<td>
                       {$item['id']}
                    </td>
					<td>{if $item['type'] ==4}报名费{else if $item['type'] ==5}考勤卡费{else}{$item['obname']}{$item['kcname']}{/if}</td>	
					<td><span class="label label-danger">{if $item['type'] !=4}{$item['s_name']}{else}{$item['signname']}{/if}</span></td>
					<td><span class="label label-danger">{$item['bjname']}</span></td>
					<td>  
						{php $userinfo = iunserializer($item['userinfo']);}
                        <span class="label label-success">
						{if $item['type'] == 4}
								{if $item['signpard'] ==2}母亲{/if}
								{if $item['signpard'] ==3}父亲{/if}
								{if $item['signpard'] ==4}本人{/if}
						{/if}
						{if !empty($userinfo)}
							{if $item['pard'] ==2}母亲:{/if}
							{if $item['pard'] ==3}父亲:{/if}
							{if $item['pard'] ==4}本人:{/if}
							{$userinfo['name']}
						{/if}
						</span>
                    </td>
					<td>
                        {if !empty($userinfo['mobile'])}{$userinfo['mobile']}{else}{$item['signmob']}{/if}
                    </td>
                    <td>
                        {if !empty($item['paytime'])}{php echo date('Y年m月d日 h:i:sa',$item['paytime'])}{/if}
                    </td>
                    <td>
                       ￥{$item['cose']}
                    </td>
                    <td>
                       {if $item['payweid']}<span class="label label-success">{$item['payweidname']}</span>{else}<span class="label label-success">{$_W['account']['name']}</span>{/if}
                    </td>					
                    <td>
                       {if $item['status'] == 1}<span class="label label-warning">未支付</span>{else if $item['status'] == 2}<span class="label label-success"><i class="fa fa-cloud">已支付</i></span>{else if $item['status'] == 3}<span class="label label-danger">已退款</span>{/if}
                    </td>
					<td>{if $item['pay_type']}
							{if $item['pay_type'] == 'wechat'}
								<span class="label label-success"><i class="fa fa-check-circle">&nbsp;微信支付</i></span>
							{else if $item['pay_type'] == 'alipay'}
								<span class="label label-info"><i class="fa fa-alipay">&nbsp;支付宝</i></span>
							{else if $item['pay_type'] == 'baifubao'}
								<span class="label label-warning"><i class="fa fa-money">&nbsp;百付宝</i></span>
							{else if $item['pay_type'] == 'unionpay'}
								<span class="label label-success"><i class="fa fa-money">&nbsp;银联</i></span>	
							{else if $item['pay_type'] == 'cash'}
								<span class="label label-success"><i class="fa fa-money">&nbsp;现金支付</i></span>
							{else if $item['pay_type'] == 'credit'}
								<span class="label label-success"><i class="fa fa-money">&nbsp;余额支付</i></span>	
							{else}
								<span class="label label-warning">&nbsp;未支付</i></span>								
							{/if}
						{/if}
					</td>					
					<td>{if $item['paytype']}
							{if $item['paytype'] == 1}
								<span class="label label-success"><i class="fa fa-check-circle">&nbsp;在线支付</i></span>
							{else if $item['paytype'] == 2}
								<span class="label label-warning"><i class="fa fa-money">&nbsp;现金支付</i></span>
							{else}
								<span class="label label-warning">&nbsp;未支付</i></span>
							{/if}
						{/if}
					</td>
					<td style="text-align:right;">
						<a class="btn btn-default btn-sm" href="{php echo $this->createWebUrl('payall', array('id' => $item['id'], 'op' => 'unpay', 'schoolid' => $schoolid))}" onclick="return confirm('此操作不可恢复，确认设为未付？');return false;" title="设置为未付"><i class="fa fa-money"></i></a>					
						<a class="btn btn-default btn-sm" href="{php echo $this->createWebUrl('payall', array('id' => $item['id'], 'op' => 'pay', 'schoolid' => $schoolid))}" onclick="return confirm('此操作不可恢复，确认设为已付？');return false;" title="设置为已付"><i class="fa fa-money"></i></a>					
						<a class="btn btn-default btn-sm" href="{php echo $this->createWebUrl('payall', array('id' => $item['id'], 'op' => 'tuifei', 'schoolid' => $schoolid))}" onclick="return confirm('此操作不可恢复，确认退费？');return false;" title="退费"><i class="fa fa-reply"></i></a>
						{if $_W['isfounder'] || $_W['role'] == 'manager'}
						<a class="btn btn-default btn-sm" href="{php echo $this->createWebUrl('baoming', array('id' => $item['id'], 'op' => 'delete', 'schoolid' => $schoolid))}" onclick="return confirm('此操作不可恢复，确认删除？');return false;" title="删除"><i class="fa fa-times"></i></a>
						{/if}
					</td>
				</tr>
				{/loop}
			</tbody>
			<tr>
				<td colspan="10">
					<input name="token" type="hidden" value="{$_W['token']}" />
                    <input type="button" class="btn btn-primary" name="btndeleteall" value="批量删除" />
					<input type="button" class="btn btn-success" name="btnpayall" value="批量付费" />
				</td>
			</tr>
		</table>
        {$pager}
    </form>
        </div>
    </div>
</div>
<script type="text/javascript">
<!--
	var category = {php echo json_encode($children)};
//-->
$(function(){
    $(".check_all").click(function(){
        var checked = $(this).get(0).checked;
        $("input[type=checkbox]").attr("checked",checked);
    });

    $("input[name=btndeleteall]").click(function(){
        var check = $("input[type=checkbox][class!=check_all]:checked");
        if(check.length < 1){
            alert('请选择要删除的订单!');
            return false;
        }
        if(confirm("确认要删除选择的订单?")){
            var id = new Array();
            check.each(function(i){
                id[i] = $(this).val();
            });
            var url = "{php echo $this->createWebUrl('payall', array('op' => 'deleteall'))}";
            $.post(
                url,
                {idArr:id},
                function(data){
                    alert('成功删除!');
                    location.reload();
                },'json'
            );
        }
    });

});

$(function(){
    $(".check_all").click(function(){
        var checked = $(this).get(0).checked;
        $("input[type=checkbox]").attr("checked",checked);
    });

    $("input[name=btnpayall]").click(function(){
        var check = $("input[type=checkbox][class!=check_all]:checked");
        if(check.length < 1){
            alert('请选择要操作的订单!');
            return false;
        }
        if(confirm("请选择要操作的订单?")){
            var id = new Array();
            check.each(function(i){
                id[i] = $(this).val();
            });
            var url = "{php echo $this->createWebUrl('payall', array('op' => 'payallorder'))}";
            $.post(
                url,
                {idArr:id},
                function(data){
                    alert('成功修改支付状态!');
                    location.reload();
                },'json'
            );
        }
    });

});
</script>

<script type="text/javascript">
    <!--
    var category = {php echo json_encode($children)};
    //-->
</script>
{/if}
{template 'public/footer'}